package search;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Comparator;

public class TwitterRecord {
	public static class FavoriteCompator implements Comparator<TwitterRecord>{

		@Override
		public int compare(TwitterRecord o1, TwitterRecord o2) {
			return o2.m_favorite - o1.m_favorite; 
		}
		
		public String toString(){
			return "favorite";
		}
		
	}
	
	@Override
	public String toString(){
		StringWriter strWriter = new StringWriter();
		PrintWriter writer = new PrintWriter(strWriter);
		writer.printf("tweetId:%s\n", m_id);
		writer.printf("user:%s\n", m_user);
		writer.printf("time:%s\n", m_time);
		writer.printf("favorite:%d\n", m_favorite);
		writer.printf("text:%s\n", m_text);
		writer.printf("**-*-*--*---**\n");
		return strWriter.toString();
	}
	
	public String m_id;
	public String m_user;
	public String m_time;
	public String m_text;
	public int m_favorite;

	public TwitterRecord(String id, String user, String time, String text) {
		m_id = id;
		m_user = user;
		m_time = time;
		m_text = text;
	}
	
	public TwitterRecord setFavorite(int favorite){
		m_favorite = favorite;
		return this;
	}

}
